package smartcase.base.log;

import org.slf4j.LoggerFactory;

import java.util.HashMap;
import java.util.Map;

public class LogFactory {
  private static final Map<Class<?>, org.slf4j.Logger> loggerMap = new HashMap<>();

  public static Log getLog(Class<?> type) {
    synchronized (LogFactory.class) {
      org.slf4j.Logger log;
      return (log = loggerMap.get(type)) != null
          ? new LogImpl(log)
          : new LogImpl(LoggerFactory.getLogger(type));
    }
  }
}
